﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_GetLeader]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_GetLeader];
GO
CREATE PROCEDURE [dbo].[sproc_GetLeader]
    @TeamID int
/*

============================================================
功能:    获得组的LEADER
参数:    
    @TeamID int        :    组ID

============================================================

*/

AS
--得到组的所有LEADER
SELECT  * 
    FROM uds_staff 
    WHERE staff_id in (
                SELECT staff_id 
                    FROM uds_staff_in_team
                    WHERE member_type =2
                      and team_id = @TeamID
                )